#include "songs.h"

extern void PlayNote(uint16_t TimArr, uint16_t DelayMs);
extern void HAL_Delay(uint32_t);
/*******************************************************************************
 * @brief  音乐 千与千寻
 * @param  None
 * @retval None
 */
void AlwaysWithMe(void)
{
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_5h,Note4p5);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_2h,Note4);
    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_2h,Note4);

    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_3h,Note4p5);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note4);

    HAL_Delay(Note4 / 4);
    PlayNote(Arr_7,Note4);
    PlayNote(Arr_6,Note4);
    PlayNote(Arr_7,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);

    PlayNote(Arr_5,Note4);
    PlayNote(Arr_1,Note4);
    PlayNote(Arr_2,Note8);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_4,Note4);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_2,Note8);
    PlayNote(Arr_1,Note8);

    PlayNote(Arr_2,Note4);
    HAL_Delay(Note4 / 4);
    PlayNote(Arr_2,Note8);
    PlayNote(Arr_1,Note8);

    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_5h,Note4p5);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_2h,Note4);
    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_2h,Note4);

    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_6,Note4p5);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);

    PlayNote(Arr_5,Note4);
    HAL_Delay(Note4 / 4);
    PlayNote(Arr_5,Note4);

    PlayNote(Arr_6,Note4);
    PlayNote(Arr_7,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);

    PlayNote(Arr_5,Note4);
    PlayNote(Arr_1h,Note4);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);

    PlayNote(Arr_4h,Note4);
    PlayNote(Arr_4h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_1h,Note8);

    PlayNote(Arr_1h,Note4);
    HAL_Delay(Note4 / 2);

    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);

    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_5h,Note4);

    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_5h,Note8);
    PlayNote(Arr_6h,Note8);
    PlayNote(Arr_5h,Note8);
    PlayNote(Arr_4h,Note8);

    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_2h,Note8);

    PlayNote(Arr_1h,Note4);
    PlayNote(Arr_1h,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_6,Note4);
    PlayNote(Arr_7,Note4);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);

    PlayNote(Arr_2h,Note4);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);

    PlayNote(Arr_2h,Note4);
    HAL_Delay(Note4 / 4);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);
}


/*******************************************************************************
 * @brief  音乐 卡农
 * @param  None
 * @retval None
 */
void Carnon(void)
{
    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);
    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);
    PlayNote(Arr_5h,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);

    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);

    PlayNote(Arr_6,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_6,Note4);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);

    PlayNote(Arr_6,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note4);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);

    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);
    PlayNote(Arr_5h,Note4);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);
    PlayNote(Arr_5h,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);

    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);

    PlayNote(Arr_6,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_6,Note4);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);

    PlayNote(Arr_6,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note4);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_5,Note8);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_4h,Note8);

    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note4);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_3h,Note8);
    PlayNote(Arr_2h,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);

    PlayNote(Arr_1h,Note4);
    PlayNote(Arr_6,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note4);
    PlayNote(Arr_1,Note8);
    PlayNote(Arr_2,Note8);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_4,Note8);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_2,Note8);
    PlayNote(Arr_3,Note8);
    PlayNote(Arr_1h,Note8);
    PlayNote(Arr_7,Note8);
    PlayNote(Arr_1h,Note8);
}

/*******************************************************************************
 * @brief  音乐 铁血丹心
 * @param  None
 * @retval None
 */
void HotBlooded(void)
{
        uint16_t mul = 2;
    PlayNote(Arr_6h,Note16 * mul);
    PlayNote(Arr_5h,Note8p5 / 2 * mul);
    PlayNote(Arr_6h,Note4 * mul);
    PlayNote(Arr_5h,Note8 * mul);
    PlayNote(Arr_3h,Note8 * mul);
    PlayNote(Arr_5h,Note4 * mul);

    PlayNote(Arr_2h,Note4 * mul);
    HAL_Delay(Note4 * mul * 3 / 4);

    PlayNote(Arr_1h,Note4 * mul);
    HAL_Delay(Note4 * mul / 4);
    PlayNote(Arr_2h,Note4 * 2);
    HAL_Delay(Note4 * mul / 4);

    PlayNote(Arr_3h,Note4 * mul);
    HAL_Delay(Note4 * mul * 3 / 4);

    PlayNote(Arr_3h,Note8 * mul);
    PlayNote(Arr_5h,Note8 * mul);
    PlayNote(Arr_6h,Note8p5 * mul);
    PlayNote(Arr_5h,Note16 * mul);

    PlayNote(Arr_5h,Note4 * mul);
    PlayNote(Arr_2h,Note4 * mul);
    HAL_Delay(Note4 * mul / 4);
    HAL_Delay(Note4 * mul / 4);

    PlayNote(Arr_1h,Note8p5 * mul);
    PlayNote(Arr_6,Note16 * mul);
    PlayNote(Arr_2h,Note8 * mul);
    PlayNote(Arr_3h,Note8 * mul);
    PlayNote(Arr_5,Note8 * mul);
    PlayNote(Arr_7,Note8 * mul);

    PlayNote(Arr_6,Note4 * mul);
    HAL_Delay(Note4 * mul * 3 / 4);
}

/*******************************************************************************
 * @brief  音乐 两只老虎
 * @param  None
 * @retval None
 */
void TwoTiggers(void)
{
    PlayNote( Arr_1h, Note4 );
    PlayNote( Arr_2h, Note4 );
    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_1h, Note4 );

    PlayNote( Arr_1h, Note4 );
    PlayNote( Arr_2h, Note4 );
    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_1h, Note4 );

    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_4h, Note4 );
    PlayNote( Arr_5h, Note4 );
    PlayNote( Arr_5h, Note4 );

    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_4h, Note4 );
    PlayNote( Arr_5h, Note4 );
    PlayNote( Arr_5h, Note4 );

    PlayNote( Arr_5h, Note8 );
    PlayNote( Arr_6h, Note8 );
    PlayNote( Arr_5h, Note8 );
    PlayNote( Arr_4h, Note8 );
    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_1h, Note8 );

    PlayNote( Arr_5h, Note8 );
    PlayNote( Arr_6h, Note8 );
    PlayNote( Arr_5h, Note8 );
    PlayNote( Arr_4h, Note8 );
    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_1h, Note8 );

    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_5,  Note4 );
    PlayNote( Arr_1h, Note4 );
    PlayNote( Arr_1h, Note4 );

    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_5,  Note4 );
    PlayNote( Arr_1h, Note4 );
    PlayNote( Arr_1h, Note4 );

    PlayNote( Arr_3h, Note4 );
    PlayNote( Arr_5,  Note4 );
    PlayNote( Arr_1h, Note4 );
    PlayNote( Arr_1h, Note4 );

    HAL_Delay( 1000 );
}
